// Image Interface
// (c) jimon game studio

#ifndef JEH_IIMAGE
#define JEH_IIMAGE

#include "jeUnknown.h"
#include "jeStl.h"
#include "jeColor.h"

namespace je
{
	namespace video
	{
		//! Image Interface
		class IImage:public je::jeUnknown
		{
		public:
			//! Destructor
			virtual ~IImage()
			{
			}

			//! Lock Image
			virtual void Lock() = 0;

			//! UnLock Image
			virtual void UnLock() = 0;

			//! Return true if locked
			virtual u1 IsLocked() = 0;

			//! Get Pointer to data
			virtual void * GetPtr() = 0;

			//! Image Color Format
			enum ImageColorFormat
			{
				//! 32 bit image format
				ICF_R8G8B8A8
			};

			//! Draw Bitmap on image
			virtual void DrawBitmapOnImage(void * Bitmap,const jeVector2di & DrawPosition,const jeVector2di & BitmapOffset,const jeVector2di & BitmapCopySize,const jeVector2di & BitmapSize,ImageColorFormat BitmapFormat,u1 WithBlending = false) = 0;

			//! Draw Image on image
			virtual void DrawImageOnImage(IImage * Image,const jeVector2di & DrawPosition,const jeVector2di & ImageOffset = jeVector2di(0,0),const jeVector2di & DrawSize = jeVector2di(0,0),u1 WithBlending = false) = 0;

			//! Return Image Format
			virtual ImageColorFormat GetFormat() = 0;

			//! Return size of image
			virtual const jeVector2di & GetSize() = 0;

			//! Return Bytes per pixel
			virtual u32 GetBytesPerPixel() = 0;

			//! Flip Image Vertical, lock and unlock if image unlocked
			virtual void FlipVertical() = 0;

			//! Flip Image Horizontal, lock and unlock if image unlocked
			virtual void FlipHorizontal() = 0;

			//! Copy
			virtual IImage * Copy(const jeVector2di & CopyPosition,const jeVector2di & CopySize) = 0;
		};

		//! Create Image
		JE_ENGINE_FUNCTION_API IImage * JE_ENGINE_FUNCTION_CALL CreateImage(const jeVector2di & Size,IImage::ImageColorFormat Format,const void * PixelData = NULL);
	}
}

#endif
